package ex.tableapi.join;

import ex.tableapi.ApiFrame;
import org.apache.flink.table.api.Table;

public class ExJoinwithTemporalTable extends ApiFrame {
    private String outName = "printOutTable";

    public static void main(String[] args) {
        ExJoinwithTemporalTable demo = new ExJoinwithTemporalTable();
        demo.getEnv();
        Table orders = demo.registerMysql("myorder", "orders");

        Table result = demo.exJoinwithTemporalTable( orders);//TODO
        demo.registerConsole(demo.createPrintOutDDL(result.getResolvedSchema().toString()), demo.outName);
        result.executeInsert(demo.outName);
    }

    private Table exJoinwithTemporalTable( Table orders) {
//
//// register temporal table function with a time attribute and primary key
//        TemporalTableFunction rates = ratesHistory.createTemporalTableFunction(
//                "r_proctime",
//                "r_currency");
//        tableEnv.registerFunction("rates", rates);
//
//// join with "Orders" based on the time attribute and key
//        Table orders = tableEnv.from("Orders");
//        Table result = orders
//                .joinLateral(call("rates", $("o_proctime")), $("o_currency").isEqual($("r_currency")));
        return null;
    }


}
